import * as actionTypes from './constants';

const defaultstate = {
    path:'/home',
    homeData:{},
    classifyIndex:0,
    classifyListData:[],
    tabbarDisplay:true
}

const reducer = (state = defaultstate, action) => {
    switch (action.type) {
        case actionTypes.SET_SHOPPING_CART_COUNT:
            return {
                ...state,
                shoppingCartCount:action.data
            }
        case actionTypes.SET_PATH:
            return {
                ...state,
                path:action.data
            }
        case actionTypes.SET_HOME_DATA:
            return {
                ...state,
                homeData:action.data
            }
        case actionTypes.SET_TABBAR_DISPLAY:
            return {
                ...state,
                tabbarDisplay:action.data
            }
        // case actionTypes.SET_CLASSIFY_INDEX:
        //     return {
        //         ...state,
        //         classifyIndex:action.data
        //     }
        // case actionTypes.SET_CLASSIFY_LIST_DATA:
        //     return {
        //         ...state,
        //         classifyListData:action.data
        //     }
        // case actionTypes.ADD_CLASSIFY_LIST_DATA:
        //     return {
        //         ...state,
        //         classifyListData:[...state.classifyListData,...action.data]
        //     }
        default:
            return state;
    }
}
export default reducer;